<?php
require_once 'config.php';

//接收id参数
$id = $_GET["id"];

//查询这条留言的内容
$sql = "SELECT * FROM `wish` WHERE `id` = $id";

$result = $conn->query($sql);

if ($result->num_rows > 0) {
    // 输出单条留言内容
    $res = $result->fetch_assoc();
    $text = $res["text"];
} else {
    die("无此条留言");
}
?>

<!DOCTYPE html>
<html>

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="stylesheet" type="text/css" href="style.css" />
    <title>编辑</title>
</head>

<body>
    <h1><?php echo $title; ?></h1>
    
    <h2>编辑 <?php echo $id;?>楼 的留言内容</h2>
    <form action="update.php" method="get">
        <input hidden type="text" name="id" value="<?php echo $id; ?>">
        <textarea class="vvv" name="content" cols="30" rows="10"><?php echo $content; ?></textarea>
        <p><input type="submit" value="更新留言"></p>
    </form>
</body>

</html>